from flask_sqlalchemy import SQLAlchemy

# 创建DB对象
db = SQLAlchemy()

class User(db.Model):
    __tablename__ = "user"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, default=0)
    username = db.Column(db.String(100), nullable=False)
    password = db.Column(db.String(100), nullable=False)
    avatar = db.Column(db.String(100), nullable=True)
    regtime = db.Column(db.String(50), nullable=True)
    email = db.Column(db.String(50), nullable=True)
    phone = db.Column(db.String(50), nullable=True)
    age = db.Column(db.Integer, nullable=True)
    ip = db.Column(db.String(50), nullable=True)

class Bottle(db.Model):
    __tablename__ = "bottle"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, default=0)
    settime = db.Column(db.String(50), nullable=False)
    setuser = db.Column(db.String(50), nullable=False)
    setip = db.Column(db.String(50), nullable=False)
    gettime = db.Column(db.String(50), nullable=True)
    getuser = db.Column(db.String(50), nullable=True)
    getip = db.Column(db.String(50), nullable=True)
    ashore = db.Column(db.String(30), nullable=True)
    type = db.Column(db.String(30), nullable=True)
    content = db.Column(db.String(2400), nullable=True)
    audio = db.Column(db.String(800), nullable=True)
    photo = db.Column(db.String(800), nullable=True)
    link = db.Column(db.String(800), nullable=True)
    ad = db.Column(db.String(800), nullable=True)
    noname = db.Column(db.String(100), nullable=True)
    note = db.Column(db.String(500), nullable=True)


class Message(db.Model):
    __tablename__ = "message"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, default=0)
    reid = db.Column(db.String(50), nullable=False)
    couser = db.Column(db.String(200), nullable=False)
    reuser = db.Column(db.String(200), nullable=False)
    retime = db.Column(db.String(50), nullable=False)
    recontent = db.Column(db.String(2000), nullable=True)
    reip = db.Column(db.String(50), nullable=True)
    note = db.Column(db.String(500), nullable=True)
